<?php
  session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="html/text; charset=utf-8" />
<title>简易BBS系统</title>
</head>
<body>
<?php
include "head.php";
include "mysql.php";
include "myfunction.php";
$aa=new mysql;
$aa->link("");
$bb=new myfunction;
include "total_info.php";
$module_id=$_GET["module_id"];
$note_id=$_GET["note_id"];
$del_id=$_GET["del_id"];

$query="update note_info set times=times+1 where id=$note_id";
$aa->excu($query);

if($_SESSION["user_name"]==$bb->son_module_idtouser_name($module_id)){
	$query="delete  from note_info where id = $del_id";
        echo "-----------";
	if($aa->excu($query)){
	echo "删除帖子成功";}
}

$today=date("Y-m-d H-i-s");
?>
<table width="98%" border="0" align="center" cellspacing="0"  cellpadding="0">
<tr>
  <td width="80%" height="15" ><?php
     echo "<a href='indexs.php'>简易BBS系统</a>>><a href='indexs.php'>".$bb->son_module_idtofarther_name($module_id)."</a>>>";
     echo $bb->son_module_idtomodule_name($module_id);
     ?>
  </td>
  <td width="20%" align="right"><a href=reply.php?note_id=<?php echo $note_id ?>&module_id=<?php echo $module_id ?>>回复帖子</a>&nbsp;&nbsp;<a href=new_note.php>发新帖子</a></td>
</tr>
<?php
 $query="select * from note_info where up_id='$note_id' order by time desc";
  $add="module_id=".$module_id."&note_id=".$note_id."&";
 ?>
<tr>
 <td colspan="2" height="15"><?php $query2=$bb->page($query,$add,$page_id,14); ?></td>
</tr>
</table>
<table>
 <tr>
  <td height="15" bgcolor="#000000"><?php "<font color='#FFFFFF'>标题:".$bb->note_idtotitle($note_id)."</font>"; ?> </td>
 </tr>
</table>
<table border="1" width="98%" align="center">
 <?php
  $query1="select * from note_info where id='$note_id' ";
  $rst1=$aa->excu($query1);
  while($note1=mysql_fetch_array($rst1)){
   ?>
  <tr>
   <td height="80" width="10%" align="center"><img src="images/1253K2142F0F-4J155.jpg" ><br>
   <?php echo $note1["user_name"]; ?></td>
   <td align="left" width="90%"><?php echo  $note1["title"]."<br>".$note1["content"]; ?></td>
  </tr>
  <?php

    $rst=$aa->excu($query2);
    while($note=mysql_fetch_array($rst)){
   ?>
   <tr>
    <td height="80" width="10%" align="center"><?php if($note["user_name"]=="游客"){
    	echo "<img src='images/1253K2142320Z-42P04.jpg'  /><br>游客";
    }else{
    	echo "<img src='images/1253K2142320Z-42P04.jpg' /><br>".$note["user_name"];
    }
    ?>
    </td>
    <td align="left" width="90%">回复:<?php echo $note1["title"]."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$note["time"];
       if($_SESSION["user_name"]==$bb->son_module_idtouser_name($module_id))
             {
        	   echo "<a href=note_show.php?module_id=".$module_id."&note_id=".$note[id]."&page_id=".$page_id."&del_id=".$del_id.">删除此贴</a>";
              }
              echo "<hr>";
              echo  $note["title"]."<br>".$note["content"];
              ?>
    </td>
   </tr>
   <?php } ?>
   <?php } ?>
   </table>
    <table width="98%" align="center"><tr><td height="15" align="right"><?php $query="select * from note_info where up_id=$note_id";
     $bb->page($query, $add, $page_id, 14);
     ?></td></tr>
    </table>
    
   <?php
    
     include "foot.php";
    ?>
   </body>
   </html>

















